﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AppWorks.Domain.Dci;

namespace MyStore.Orders.Contexts
{
    public class AddCartItemContext : IContext
    {
        private Customer _customer;
        private Cart _cart;
        private CartItem _item;

        public AddCartItemContext(Customer customer, Cart cart, CartItem item)
        {
            _customer = customer;
            _cart = cart;
            _item = item;
        }

        #region IContext 成员

        public void Interact()
        {
            if (_cart == null)
                _cart = new Cart(_customer.CartID, _customer.MmeberID);

            if (_item.IsCanAddToCart)
            { }

            if (_cart.IsValid)
                _cart.Save();
        }

        #endregion
    }
}
